-
Notifications
You must be signed in to change notification settings - Fork 271
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #37761 - Allow rewrites needed for cockpit integration #1177
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, shouldn't this flag be with RewriteRule?
Like this:
<Location /webcon>
ProxyPreserveHost On
RewriteEngine On
RewriteCond %{HTTP:Upgrade} =websocket [NC]
RewriteRule /webcon/(.*) ws://127.0.0.1:19090/webcon/$1 [P,UnsafeAllow3F]
RewriteCond %{HTTP:Upgrade} !=websocket [NC]
RewriteRule /webcon/(.*) http://127.0.0.1:19090/webcon/$1 [P,UnsafeAllow3F]
</Location>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Eh, yes, sorry
b656ac7
to
d4b7c20
Compare
d4b7c20
to
6086ec2
Compare
Mhh, UnsafeAllow3F is disabling the fix for https://www.cve.org/CVERecord?id=CVE-2024-38474 which raises the following two concerns:
|
It will.
I'm afraid we cannot. I'll try looking into it a little bit more next week, but I'd be surprised if we could avoid it. If I'm reading things right then the flow looks like this:
@mvollmer Hi, since you originally wrote most of this, would you have any ideas how we could resolve this situation? |
Ha! Scratch all that, apparently the token can be passed in as part of the query string or as an uri fragment, going with an uri fragment seems to do the trick |
Nice that you have figured this out! I don't think I understand how this all works together in detail, but: is the rewrite rule only used during authentication, or also when Cockpit is already open and for loading the actual Cockpit URLs like If so, this change to the rewrite rules might break downloading of SOS reports, and downloading of files in general in the new cockpit-files component. Downloading is done with "external channels" that use URLs like If that is indeed the case, I think we can change Cockpit to not use the query part of URLs for this mechanism. |
As far as I can tell it is used for every single request, no matter what "stage" we're at.
Sigh, looks like you're right, trying to download a sosreport does fail with a 403 and the unsafe rewrite error in httpd error log.
That would be nice Thinking out loud: right now, we rewrite anything coming to |
Configuring httpd like this seems to work, any concerns about it?
|
I thought https://httpd.apache.org/docs/current/rewrite/flags.html#flag_p But are we now proxying HTTP or WS? |
I would say we are still proxying both? http with proxypass and ws by rewriting the request and then proxying it?
I'm not fluent in apache config, but isn't it more or less still there? Before we did if-elseif, now (in #1178) we do if-else, but it should be equivalent? |
Tell me if you need it! :-) I am not sure I can follow the discussion about the rewrite rules... The current assumption seems to be that ProxyPass works and can handle query parts just fine, and no changes to Cockpit are necessary, right? |
Yup, so far we're good. I'll let you know if anything changes, thank you |
No description provided.